package com.cnbm.wcsbasic.dispatch.enums.ddj.ddj2;

import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.api.DaveArea;
import com.cnbm.wcsbasic.protocol.netty.s7.s7connector.type.PlcVar;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2023/2/21 19:35
 */
public enum DDJWcs2PlcVar {

    Mission_Count("Mission_Count", PlcVar.INT,1, DaveArea.DB,1,0,0),
    Command_No("Command_No", PlcVar.INT,1, DaveArea.DB,1,2,0),
    Mission_Type("Mission_Type",PlcVar.INT,1,DaveArea.DB,1,4,0),
    From_Row("From_Row",PlcVar.INT,1,DaveArea.DB,1,6,0),
    From_List("From_List",PlcVar.INT,1,DaveArea.DB,1,8,0),
    From_Layer("From_Layer",PlcVar.INT,1,DaveArea.DB,1,10,0),
    To_Row("To_Row",PlcVar.INT,1,DaveArea.DB,1,12,0),
    To_List("To_List",PlcVar.INT,1,DaveArea.DB,1,14,0),
    To_Layer("To_Layer",PlcVar.INT,1,DaveArea.DB,1,16,0),
    Control_bit1("Status_bit1", PlcVar.BOOL_Array,8, DaveArea.DB,1,18,0),
    Control_bit2("Status_bit2", PlcVar.BOOL_Array,8, DaveArea.DB,1,19,0),
    Goods_Size("Goods_Size", PlcVar.INT,1, DaveArea.DB,1,20,0),
    Coordinate_conversion("Coordinate_conversion", PlcVar.INT,1, DaveArea.DB,1,22,0),
    Mission_ID("Mission_ID", PlcVar.INT,1, DaveArea.DB,1,24,0),
    //todo 条码值 要写长度
    Pallet_Num("Pallet_Num", PlcVar.STRING,1, DaveArea.DB,1,26,0,6),

    ;

    private String name;
    private DaveArea area;
    private Integer areaNumber;
    private Integer byteOffset;
    private Integer bitOffset;
    private PlcVar type;
    //length = 1代表 非数组;;;       length > 1 代表数组  ;; 注意 length这个参数 是实际plc中 数组的长度，和read操作相关
    //如果是String 类型不用填length 只需要填string类型的起始位置就行了，我会自己去取数据长度（也就是说这里的length并不是string 的长度）。
    private Integer length;

    //这个字段只是给 字符串变量 和 字符串数组 用, 这个字段是plc中设置的最大String长度
    private Integer strSize;

    DDJWcs2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = 0;
    }
    DDJWcs2PlcVar(String name, PlcVar type, Integer length, DaveArea area, Integer areaNumber, Integer byteOffset, Integer bitOffset, Integer strSize){
        this.name = name;
        this.type = type;
        this.length = length;
        this.area = area;
        this.areaNumber = areaNumber;
        this.byteOffset = byteOffset;
        this.bitOffset = bitOffset;
        this.strSize = strSize;
    }

    public Integer getStrSize() {
        return strSize;
    }

    public void setStrSize(Integer strSize) {
        this.strSize = strSize;
    }

    public String getName() {
        return name;
    }

    public DaveArea getArea() {
        return area;
    }

    public Integer getAreaNumber() {
        return areaNumber;
    }

    public Integer getBitOffset() {
        return bitOffset;
    }

    public Integer getByteOffset() {
        return byteOffset;
    }

    public PlcVar getType() {
        return type;
    }

    public Integer getLength() {
        return length;
    }
}
